package com.t11;

/**
 * Created by xuyiwei on 2018/7/22.
 */
import java.util.*;
import net.mindview.util.*;

public class UniqueWords {
    public static void main(String[] args) {
        //这种情况下是大小写区分的
        Set<String> words = new TreeSet<String>(
                new TextFile("src/com/t11/SetOperations.java", "\\W+"));
        System.out.println(words);
        /**
         * [2018, 22, 7, A, B, C, Collections, Created, D, E, F, G, H, HashSet, I, J, K, L, M, N, Print, Set, SetOperations, String, X, Y, Z, add, addAll, added, args, by, class, com, contains, containsAll, from, import, in, java, main, mindview, net, new, on, package, print, public, remove, removeAll, removed, set1, set2, split, static, t11, to, util, void, xuyiwei]
         */
        //往构造器里面添加String.CASE_INSENSITIVE_ORDER之后 就不会区分大小写
        Set<String> word1 = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
        word1.addAll(new TextFile("src/com/t11/SetOperations.java", "\\W+"));
        System.out.println(word1);
        /**
         * [2018, 22, 7, A, add, addAll, added, args, B, by, C, class, Collections, com, contains, containsAll, Created, D, E, F, from, G, H, HashSet, I, import, in, J, java, K, L, M, main, mindview, N, net, new, on, package, Print, public, remove, removeAll, removed, Set, set1, set2, SetOperations, split, static, String, t11, to, util, void, X, xuyiwei, Y, Z]
         */
    }
}